#include "BattleStatus.h"


BattleStatus::BattleStatus ()
: _totalTime (TIME_PER_ROUND), _timeLeft (TIME_PER_ROUND), _sunDegree (60.0f)
{
  _generate_player_mng ();
  _pPlayerMng->turn_next ();
}

void BattleStatus::shift ()
{
  _pPlayerMng->turn_next ();
}

Player BattleStatus::cur_player () const
{
  return _pPlayerMng->cur_player ();
}



void BattleStatus::set_sun_degree (float degree)
{
  _sunDegree = degree;
}

void BattleStatus::sun_move ()
{
  //_sunDegree = _sunDegree + DELTA_SUN_MOVE;
  if (_sunDegree > 360.0f) _sunDegree -= 360.0f;
}

float BattleStatus::sun_degree () const
{
  return _sunDegree;
}



void BattleStatus::set_total_time (unsigned int totalTime)
{
  _totalTime = totalTime;
}

unsigned int BattleStatus::total_time () const
{
  return _totalTime;
}

void BattleStatus::set_time (unsigned int time)
{
  _timeLeft = time;
}

void BattleStatus::reset_time ()
{
  _timeLeft = _totalTime;
}

bool BattleStatus::time_minus ()
{
  --_timeLeft;
  if (_timeLeft == 0)
  {
    reset_time ();
    return true;
  }
  return false;
}

unsigned int BattleStatus::time_left () const
{
  return _timeLeft;
}

void BattleStatus::_generate_player_mng ()
{
  vector< Color3f > colorCollect;
  colorCollect.push_back (Color3f (1.0f, 1.0f, 1.0f));
  colorCollect.push_back (Color3f (1.0f, 0.0f, 0.0f));
  colorCollect.push_back (Color3f (0.0f, 1.0f, 0.0f));
  colorCollect.push_back (Color3f (0.0f, 0.0f, 1.0f));
  _pPlayerMng = new PlayerManager (colorCollect);
  _pPlayerMng->add_player (PLAYER_RED);
  _pPlayerMng->add_player (PLAYER_BLUE);
}
